/**
 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.crossriver.crgis.database.model.impl;

import com.crossriver.crgis.database.model.Transactions;
import com.crossriver.crgis.database.model.TransactionsModel;
import com.crossriver.crgis.database.model.TransactionsSoap;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.impl.BaseModelImpl;

import java.io.Serializable;

import java.lang.reflect.Proxy;

import java.sql.Types;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * The base model implementation for the Transactions service. Represents a row in the &quot;CRGIA_Transactions&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link com.crossriver.crgis.database.model.TransactionsModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link TransactionsImpl}.
 * </p>
 *
 * <p>
 * Never modify or reference this class directly. All methods that expect a transactions model instance should use the {@link com.crossriver.crgis.database.model.Transactions} interface instead.
 * </p>
 *
 * @author Wole Adetiba
 * @see TransactionsImpl
 * @see com.crossriver.crgis.database.model.Transactions
 * @see com.crossriver.crgis.database.model.TransactionsModel
 * @generated
 */
public class TransactionsModelImpl extends BaseModelImpl<Transactions>
	implements TransactionsModel {
	public static final String TABLE_NAME = "CRGIA_Transactions";
	public static final Object[][] TABLE_COLUMNS = {
			{ "transactionNo", new Integer(Types.VARCHAR) },
			{ "userId", new Integer(Types.VARCHAR) },
			{ "transactionRef", new Integer(Types.VARCHAR) },
			{ "itemId", new Integer(Types.VARCHAR) },
			{ "itemDescription", new Integer(Types.VARCHAR) },
			{ "paymentType", new Integer(Types.VARCHAR) },
			{ "paymentDate", new Integer(Types.TIMESTAMP) },
			{ "receiptNo", new Integer(Types.VARCHAR) },
			{ "invoiceNo", new Integer(Types.VARCHAR) },
			{ "applicationType", new Integer(Types.VARCHAR) },
			{ "bankCode", new Integer(Types.VARCHAR) },
			{ "bankName", new Integer(Types.VARCHAR) },
			{ "bankReference", new Integer(Types.VARCHAR) },
			{ "accountNo", new Integer(Types.VARCHAR) },
			{ "amount", new Integer(Types.DOUBLE) },
			{ "approvedAmount", new Integer(Types.DOUBLE) },
			{ "transactionFee", new Integer(Types.DOUBLE) },
			{ "batchId", new Integer(Types.VARCHAR) },
			{ "status", new Integer(Types.VARCHAR) },
			{ "responseCode", new Integer(Types.VARCHAR) },
			{ "responseDescription", new Integer(Types.VARCHAR) },
			{ "payRef", new Integer(Types.VARCHAR) },
			{ "retRef", new Integer(Types.VARCHAR) },
			{ "cardNum", new Integer(Types.VARCHAR) }
		};
	public static final String TABLE_SQL_CREATE = "create table CRGIA_Transactions (transactionNo VARCHAR(75) not null primary key,userId VARCHAR(75) null,transactionRef VARCHAR(75) null,itemId VARCHAR(75) null,itemDescription VARCHAR(75) null,paymentType VARCHAR(75) null,paymentDate DATE null,receiptNo VARCHAR(75) null,invoiceNo VARCHAR(75) null,applicationType VARCHAR(75) null,bankCode VARCHAR(75) null,bankName VARCHAR(75) null,bankReference VARCHAR(75) null,accountNo VARCHAR(75) null,amount DOUBLE,approvedAmount DOUBLE,transactionFee DOUBLE,batchId VARCHAR(75) null,status VARCHAR(75) null,responseCode VARCHAR(75) null,responseDescription VARCHAR(75) null,payRef VARCHAR(75) null,retRef VARCHAR(75) null,cardNum VARCHAR(75) null)";
	public static final String TABLE_SQL_DROP = "drop table CRGIA_Transactions";
	public static final String ORDER_BY_JPQL = " ORDER BY transactions.transactionNo ASC";
	public static final String ORDER_BY_SQL = " ORDER BY CRGIA_Transactions.transactionNo ASC";
	public static final String DATA_SOURCE = "liferayDataSource";
	public static final String SESSION_FACTORY = "liferaySessionFactory";
	public static final String TX_MANAGER = "liferayTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.com.crossriver.crgis.database.model.Transactions"),
			true);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.com.crossriver.crgis.database.model.Transactions"),
			true);

	/**
	 * Converts the soap model instance into a normal model instance.
	 *
	 * @param soapModel the soap model instance to convert
	 * @return the normal model instance
	 */
	public static Transactions toModel(TransactionsSoap soapModel) {
		Transactions model = new TransactionsImpl();

		model.setTransactionNo(soapModel.getTransactionNo());
		model.setUserId(soapModel.getUserId());
		model.setTransactionRef(soapModel.getTransactionRef());
		model.setItemId(soapModel.getItemId());
		model.setItemDescription(soapModel.getItemDescription());
		model.setPaymentType(soapModel.getPaymentType());
		model.setPaymentDate(soapModel.getPaymentDate());
		model.setReceiptNo(soapModel.getReceiptNo());
		model.setInvoiceNo(soapModel.getInvoiceNo());
		model.setApplicationType(soapModel.getApplicationType());
		model.setBankCode(soapModel.getBankCode());
		model.setBankName(soapModel.getBankName());
		model.setBankReference(soapModel.getBankReference());
		model.setAccountNo(soapModel.getAccountNo());
		model.setAmount(soapModel.getAmount());
		model.setApprovedAmount(soapModel.getApprovedAmount());
		model.setTransactionFee(soapModel.getTransactionFee());
		model.setBatchId(soapModel.getBatchId());
		model.setStatus(soapModel.getStatus());
		model.setResponseCode(soapModel.getResponseCode());
		model.setResponseDescription(soapModel.getResponseDescription());
		model.setPayRef(soapModel.getPayRef());
		model.setRetRef(soapModel.getRetRef());
		model.setCardNum(soapModel.getCardNum());

		return model;
	}

	/**
	 * Converts the soap model instances into normal model instances.
	 *
	 * @param soapModels the soap model instances to convert
	 * @return the normal model instances
	 */
	public static List<Transactions> toModels(TransactionsSoap[] soapModels) {
		List<Transactions> models = new ArrayList<Transactions>(soapModels.length);

		for (TransactionsSoap soapModel : soapModels) {
			models.add(toModel(soapModel));
		}

		return models;
	}

	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.com.crossriver.crgis.database.model.Transactions"));

	public TransactionsModelImpl() {
	}

	public String getPrimaryKey() {
		return _transactionNo;
	}

	public void setPrimaryKey(String pk) {
		setTransactionNo(pk);
	}

	public Serializable getPrimaryKeyObj() {
		return _transactionNo;
	}

	public String getTransactionNo() {
		if (_transactionNo == null) {
			return StringPool.BLANK;
		}
		else {
			return _transactionNo;
		}
	}

	public void setTransactionNo(String transactionNo) {
		_transactionNo = transactionNo;
	}

	public String getUserId() {
		if (_userId == null) {
			return StringPool.BLANK;
		}
		else {
			return _userId;
		}
	}

	public void setUserId(String userId) {
		_userId = userId;
	}

	public String getTransactionRef() {
		if (_transactionRef == null) {
			return StringPool.BLANK;
		}
		else {
			return _transactionRef;
		}
	}

	public void setTransactionRef(String transactionRef) {
		_transactionRef = transactionRef;
	}

	public String getItemId() {
		if (_itemId == null) {
			return StringPool.BLANK;
		}
		else {
			return _itemId;
		}
	}

	public void setItemId(String itemId) {
		_itemId = itemId;
	}

	public String getItemDescription() {
		if (_itemDescription == null) {
			return StringPool.BLANK;
		}
		else {
			return _itemDescription;
		}
	}

	public void setItemDescription(String itemDescription) {
		_itemDescription = itemDescription;
	}

	public String getPaymentType() {
		if (_paymentType == null) {
			return StringPool.BLANK;
		}
		else {
			return _paymentType;
		}
	}

	public void setPaymentType(String paymentType) {
		_paymentType = paymentType;
	}

	public Date getPaymentDate() {
		return _paymentDate;
	}

	public void setPaymentDate(Date paymentDate) {
		_paymentDate = paymentDate;
	}

	public String getReceiptNo() {
		if (_receiptNo == null) {
			return StringPool.BLANK;
		}
		else {
			return _receiptNo;
		}
	}

	public void setReceiptNo(String receiptNo) {
		_receiptNo = receiptNo;
	}

	public String getInvoiceNo() {
		if (_invoiceNo == null) {
			return StringPool.BLANK;
		}
		else {
			return _invoiceNo;
		}
	}

	public void setInvoiceNo(String invoiceNo) {
		_invoiceNo = invoiceNo;
	}

	public String getApplicationType() {
		if (_applicationType == null) {
			return StringPool.BLANK;
		}
		else {
			return _applicationType;
		}
	}

	public void setApplicationType(String applicationType) {
		_applicationType = applicationType;
	}

	public String getBankCode() {
		if (_bankCode == null) {
			return StringPool.BLANK;
		}
		else {
			return _bankCode;
		}
	}

	public void setBankCode(String bankCode) {
		_bankCode = bankCode;
	}

	public String getBankName() {
		if (_bankName == null) {
			return StringPool.BLANK;
		}
		else {
			return _bankName;
		}
	}

	public void setBankName(String bankName) {
		_bankName = bankName;
	}

	public String getBankReference() {
		if (_bankReference == null) {
			return StringPool.BLANK;
		}
		else {
			return _bankReference;
		}
	}

	public void setBankReference(String bankReference) {
		_bankReference = bankReference;
	}

	public String getAccountNo() {
		if (_accountNo == null) {
			return StringPool.BLANK;
		}
		else {
			return _accountNo;
		}
	}

	public void setAccountNo(String accountNo) {
		_accountNo = accountNo;
	}

	public Double getAmount() {
		return _amount;
	}

	public void setAmount(Double amount) {
		_amount = amount;
	}

	public Double getApprovedAmount() {
		return _approvedAmount;
	}

	public void setApprovedAmount(Double approvedAmount) {
		_approvedAmount = approvedAmount;
	}

	public Double getTransactionFee() {
		return _transactionFee;
	}

	public void setTransactionFee(Double transactionFee) {
		_transactionFee = transactionFee;
	}

	public String getBatchId() {
		if (_batchId == null) {
			return StringPool.BLANK;
		}
		else {
			return _batchId;
		}
	}

	public void setBatchId(String batchId) {
		_batchId = batchId;
	}

	public String getStatus() {
		if (_status == null) {
			return StringPool.BLANK;
		}
		else {
			return _status;
		}
	}

	public void setStatus(String status) {
		_status = status;
	}

	public String getResponseCode() {
		if (_responseCode == null) {
			return StringPool.BLANK;
		}
		else {
			return _responseCode;
		}
	}

	public void setResponseCode(String responseCode) {
		_responseCode = responseCode;
	}

	public String getResponseDescription() {
		if (_responseDescription == null) {
			return StringPool.BLANK;
		}
		else {
			return _responseDescription;
		}
	}

	public void setResponseDescription(String responseDescription) {
		_responseDescription = responseDescription;
	}

	public String getPayRef() {
		if (_payRef == null) {
			return StringPool.BLANK;
		}
		else {
			return _payRef;
		}
	}

	public void setPayRef(String payRef) {
		_payRef = payRef;
	}

	public String getRetRef() {
		if (_retRef == null) {
			return StringPool.BLANK;
		}
		else {
			return _retRef;
		}
	}

	public void setRetRef(String retRef) {
		_retRef = retRef;
	}

	public String getCardNum() {
		if (_cardNum == null) {
			return StringPool.BLANK;
		}
		else {
			return _cardNum;
		}
	}

	public void setCardNum(String cardNum) {
		_cardNum = cardNum;
	}

	public Transactions toEscapedModel() {
		if (isEscapedModel()) {
			return (Transactions)this;
		}
		else {
			return (Transactions)Proxy.newProxyInstance(Transactions.class.getClassLoader(),
				new Class[] { Transactions.class },
				new AutoEscapeBeanHandler(this));
		}
	}

	public Object clone() {
		TransactionsImpl transactionsImpl = new TransactionsImpl();

		transactionsImpl.setTransactionNo(getTransactionNo());

		transactionsImpl.setUserId(getUserId());

		transactionsImpl.setTransactionRef(getTransactionRef());

		transactionsImpl.setItemId(getItemId());

		transactionsImpl.setItemDescription(getItemDescription());

		transactionsImpl.setPaymentType(getPaymentType());

		transactionsImpl.setPaymentDate(getPaymentDate());

		transactionsImpl.setReceiptNo(getReceiptNo());

		transactionsImpl.setInvoiceNo(getInvoiceNo());

		transactionsImpl.setApplicationType(getApplicationType());

		transactionsImpl.setBankCode(getBankCode());

		transactionsImpl.setBankName(getBankName());

		transactionsImpl.setBankReference(getBankReference());

		transactionsImpl.setAccountNo(getAccountNo());

		transactionsImpl.setAmount(getAmount());

		transactionsImpl.setApprovedAmount(getApprovedAmount());

		transactionsImpl.setTransactionFee(getTransactionFee());

		transactionsImpl.setBatchId(getBatchId());

		transactionsImpl.setStatus(getStatus());

		transactionsImpl.setResponseCode(getResponseCode());

		transactionsImpl.setResponseDescription(getResponseDescription());

		transactionsImpl.setPayRef(getPayRef());

		transactionsImpl.setRetRef(getRetRef());

		transactionsImpl.setCardNum(getCardNum());

		return transactionsImpl;
	}

	public int compareTo(Transactions transactions) {
		int value = 0;

		value = getTransactionNo().compareTo(transactions.getTransactionNo());

		if (value != 0) {
			return value;
		}

		return 0;
	}

	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		Transactions transactions = null;

		try {
			transactions = (Transactions)obj;
		}
		catch (ClassCastException cce) {
			return false;
		}

		String pk = transactions.getPrimaryKey();

		if (getPrimaryKey().equals(pk)) {
			return true;
		}
		else {
			return false;
		}
	}

	public int hashCode() {
		return getPrimaryKey().hashCode();
	}

	public String toString() {
		StringBundler sb = new StringBundler(49);

		sb.append("{transactionNo=");
		sb.append(getTransactionNo());
		sb.append(", userId=");
		sb.append(getUserId());
		sb.append(", transactionRef=");
		sb.append(getTransactionRef());
		sb.append(", itemId=");
		sb.append(getItemId());
		sb.append(", itemDescription=");
		sb.append(getItemDescription());
		sb.append(", paymentType=");
		sb.append(getPaymentType());
		sb.append(", paymentDate=");
		sb.append(getPaymentDate());
		sb.append(", receiptNo=");
		sb.append(getReceiptNo());
		sb.append(", invoiceNo=");
		sb.append(getInvoiceNo());
		sb.append(", applicationType=");
		sb.append(getApplicationType());
		sb.append(", bankCode=");
		sb.append(getBankCode());
		sb.append(", bankName=");
		sb.append(getBankName());
		sb.append(", bankReference=");
		sb.append(getBankReference());
		sb.append(", accountNo=");
		sb.append(getAccountNo());
		sb.append(", amount=");
		sb.append(getAmount());
		sb.append(", approvedAmount=");
		sb.append(getApprovedAmount());
		sb.append(", transactionFee=");
		sb.append(getTransactionFee());
		sb.append(", batchId=");
		sb.append(getBatchId());
		sb.append(", status=");
		sb.append(getStatus());
		sb.append(", responseCode=");
		sb.append(getResponseCode());
		sb.append(", responseDescription=");
		sb.append(getResponseDescription());
		sb.append(", payRef=");
		sb.append(getPayRef());
		sb.append(", retRef=");
		sb.append(getRetRef());
		sb.append(", cardNum=");
		sb.append(getCardNum());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(76);

		sb.append("<model><model-name>");
		sb.append("com.crossriver.crgis.database.model.Transactions");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>transactionNo</column-name><column-value><![CDATA[");
		sb.append(getTransactionNo());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>userId</column-name><column-value><![CDATA[");
		sb.append(getUserId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>transactionRef</column-name><column-value><![CDATA[");
		sb.append(getTransactionRef());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>itemId</column-name><column-value><![CDATA[");
		sb.append(getItemId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>itemDescription</column-name><column-value><![CDATA[");
		sb.append(getItemDescription());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>paymentType</column-name><column-value><![CDATA[");
		sb.append(getPaymentType());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>paymentDate</column-name><column-value><![CDATA[");
		sb.append(getPaymentDate());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>receiptNo</column-name><column-value><![CDATA[");
		sb.append(getReceiptNo());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>invoiceNo</column-name><column-value><![CDATA[");
		sb.append(getInvoiceNo());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>applicationType</column-name><column-value><![CDATA[");
		sb.append(getApplicationType());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>bankCode</column-name><column-value><![CDATA[");
		sb.append(getBankCode());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>bankName</column-name><column-value><![CDATA[");
		sb.append(getBankName());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>bankReference</column-name><column-value><![CDATA[");
		sb.append(getBankReference());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>accountNo</column-name><column-value><![CDATA[");
		sb.append(getAccountNo());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>amount</column-name><column-value><![CDATA[");
		sb.append(getAmount());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>approvedAmount</column-name><column-value><![CDATA[");
		sb.append(getApprovedAmount());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>transactionFee</column-name><column-value><![CDATA[");
		sb.append(getTransactionFee());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>batchId</column-name><column-value><![CDATA[");
		sb.append(getBatchId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>status</column-name><column-value><![CDATA[");
		sb.append(getStatus());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>responseCode</column-name><column-value><![CDATA[");
		sb.append(getResponseCode());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>responseDescription</column-name><column-value><![CDATA[");
		sb.append(getResponseDescription());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>payRef</column-name><column-value><![CDATA[");
		sb.append(getPayRef());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>retRef</column-name><column-value><![CDATA[");
		sb.append(getRetRef());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>cardNum</column-name><column-value><![CDATA[");
		sb.append(getCardNum());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private String _transactionNo;
	private String _userId;
	private String _transactionRef;
	private String _itemId;
	private String _itemDescription;
	private String _paymentType;
	private Date _paymentDate;
	private String _receiptNo;
	private String _invoiceNo;
	private String _applicationType;
	private String _bankCode;
	private String _bankName;
	private String _bankReference;
	private String _accountNo;
	private Double _amount;
	private Double _approvedAmount;
	private Double _transactionFee;
	private String _batchId;
	private String _status;
	private String _responseCode;
	private String _responseDescription;
	private String _payRef;
	private String _retRef;
	private String _cardNum;
}